import request from '@/utils/request'

// 查询栏目内容列表
export function listContent(query) {
  return request({
    url: '/system/content/list',
    method: 'get',
    params: query
  })
}

// 查询栏目内容详细
export function getContent(contentId) {
  return request({
    url: '/system/content/' + contentId,
    method: 'get'
  })
}

// 新增栏目内容
export function addContent(data) {
  return request({
    url: '/system/content',
    method: 'post',
    data: data
  })
}

// 修改栏目内容
export function updateContent(data) {
  return request({
    url: '/system/content',
    method: 'put',
    data: data
  })
}

// 删除栏目内容
export function delContent(contentId) {
  return request({
    url: '/system/content/' + contentId,
    method: 'delete'
  })
}

// 导出栏目内容
export function exportContent(query) {
  return request({
    url: '/system/content/export',
    method: 'get',
    params: query
  })
}

// 查询下拉树结构
export function treeselect() {
  return request({
    url: '/system/statute/treeselect',
    method: 'get'
  })
}

// 置顶修改
export function changeTop(contentId, istop) {
  const data = {
    contentId,
    istop
  }
  return request({
    url: '/system/content/changeTop',
    method: 'put',
    data: data
  })
}

//下载文件
export function getFile (url){
  return request({
    url: url,
    method: 'get',
    responseType: 'arraybuffer'
  })
}

//根据栏目树
export function treeselectColumn(query) {
  return request({
    url: '/system/column/treeselect',
    method: 'get',
    params: query
  })
}
